package com.axjy.service.impl;

import com.axjy.mapper.UserMapper;
import com.axjy.service.UserService;
import com.axjy.vo.PageVo;
import com.axjy.vo.UserDto;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
@Transactional
public class UserServiceImpl implements UserService{
    @Resource
    private UserMapper userMapper;
    @Override
    public PageVo search(Integer offset, Integer limit, UserDto dto) {
        PageHelper.offsetPage(offset,limit);
        List list=  userMapper.search(dto);
        return new PageVo(list);
    }

    @Override
    public void grant(Integer userId, Integer roleId) {
        userMapper.update(userId,roleId);
    }

    @Override
    public Integer batchDel(Integer[] ids) {
       return userMapper.del(ids);
    }
}
